public class h_3 implements Runnable{
    private h_3_demo hd;
    public h_3(h_3_demo hd){
        this.hd=hd;
    }
    @Override
    public void run() {
        for (int i = 0; i <3 ; i++) {
            synchronized (hd.getO()){
                while(hd.isFlag()==true){
                    try {
                        hd.getO().wait();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                hd.ziThread();
                hd.setFlag(true);
                hd.getO().notify();
            }
        }
    }

}
